(function (BOM) {

/* ----------- 数组随机元素 ----------- */
    function Random_SN(iArray) {
        return  Math.floor(Math.random() * iArray.length);
    }

    function Probability_Random(iArray) {
        var Random_Int;
        if (iArray.Random_SN === undefined)
            iArray.Random_SN = -1;
        do  Random_Int = Random_SN(iArray);
        while ( Random_Int == iArray.Random_SN )
        iArray.Random_SN = Random_Int;
        return iArray[Random_Int];
    }

    function Sequence_Random(iArray) {
        return  iArray.splice(Random_SN(iArray), 1);
    }

    Array.prototype.random = function (Mode, Pop) {
        if (! Mode)
            return  Probability_Random(this);
        if (! Pop) {
            if (! (this.Random_Queue && this.Random_Queue.length))
                this.Random_Queue = [].concat(this);
            return  Sequence_Random(this.Random_Queue);
        }
        return  Sequence_Random(this);
    };

/* ----------- 字符串两端空白符清除 ----------- */
    BOM.iRegExp = function (Pattern, Mode) {
        var RegEx = / /;
        RegEx.compile(Pattern, Mode);
        return RegEx;
    };
    if (String.prototype.trim instanceof Function) return;

    var RegEx = iRegExp('(^\s*)|(\s*$)', 'g');
    String.prototype.trim = function () {
        return this.replace(RegEx, '');
    };
})(top);

(function (BOM, iLanguage, iProxy) {

    var iKeyWord = (function (_BOM_) {
        var _DOM_ = _BOM_.document;
        var This_Tag = _DOM_.activeElement;
        try {
            return _DOM_.selection.createRange().text;
        } catch (iError) {}
        switch ( This_Tag.tagName.toLowerCase() ) {
            case 'input':       ;
            case 'textarea':    with (This_Tag)
                return value.slice(selectionStart, selectionEnd);
            case 'iframe':
                return arguments.callee( This_Tag.contentWindow );
            case 'body':        ;
            default:            return _DOM_.getSelection().toString();
        }
    })(BOM).trim();

    if ( iKeyWord )
        BOM.open([
            'http://', iProxy.random(true),
            '/search?newwindow=1&lr=lang_', iLanguage,
            '&q=', encodeURIComponent(iKeyWord)
        ].join(''), '_blank');
    else if ( BOM.confirm(
        "您未选中任何网页中的文字……\n\n\n『确定』进入问题反馈；『取消』即退出本工具。"
    ) ) {
        BOM.prompt(
            "输入框中的是『运行环境』信息，请直接复制它们，按『确认』即可访问 原作者主页～",
            navigator.userAgent
        );
        BOM.open('http://www.fyscu.com/', '_blank');
    } else  BOM.alert(
        "【Google 中文划词搜索 v1.3】\n\n(C)2013-2014  四川大学·飞扬俱乐部·研发部"
    );
})(top, 'zh-CN', [
    'sssis.com',
    'www.90r.org',
    'booo.so',
    'g.ttlsa.com',
    'lamjoeone.info',
    'g.net.co',
    'iguge.tk',
    'jiong.lu',
    'xie.lu',
    'ggncr.com',
    'everthis.com',
    'ppx.pw',
    'gugesou.com',
    'soso.red',
    '521.pt',
    'google.sqzr.cc',
    'yue.pao.im',
    'da.pao.im',
    'g.xjliao.me',
    'gg.eeload.com',
    'repigu.com',
    'jinke.la',
    'glgoo.com',
    'googleforchina.com',
    '74.125.12.198',
    '209.116.186.219',
    '173.194.121.28',
    'g.hi18.cn'
]);